package boot

import (
	"gitee.com/libwiki/lib-mall/models"
	"gitee.com/libwiki/lib-mall/models/goodsModel"
	"gitee.com/libwiki/lib-mall/models/ordersModel"
	"gitee.com/libwiki/lib-mall/models/storeModel"
	"gitee.com/libwiki/lib-mall/models/userModel"
	"gitee.com/libwiki/lib-mall/package/database"
)

func AutoMigrate() {
	database.Db().Set("gorm:table_options", "ENGINE=InnoDB").AutoMigrate(
		models.Category{},            // 分类表
		goodsModel.GoodsAttrs{},      // 商品规格属性分类表
		goodsModel.GoodsSource{},     // 货源表
		goodsModel.GoodsSourceSku{},  // 货源规格表
		goodsModel.GoodsProduct{},    // 商品表
		goodsModel.GoodsProductSku{}, // 商品规格表
		ordersModel.Orders{},         // 总订单表
		ordersModel.SubOrders{},      // 子订单表
		storeModel.Store{},           // 门店表
		userModel.User{},             // 用户表
		userModel.OauthClient{},      // oauth权限表
	)
}
